﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IM.Easy.Core.Audit
{
    /// <summary>
    /// 审计
    /// </summary>
    public interface IAuditable : ICreated, IUpdated, ISoftDelete
    {

    }

    public class Auditable : IAuditable
    {
        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建时间", IsNullable = true)]
        public DateTime? CreatedAt { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建人")]
        public long CreatedBy { get; set; }

        /// <summary>
        /// 最后更新人
        /// </summary>
        [SugarColumn(ColumnDescription = "最后更新人")]
        public long UpdatedBy { get; set; }

        /// <summary>
        /// 最后更新时间
        /// </summary>
        [SugarColumn(ColumnDescription = "最后更新时间", IsNullable = true)]
        public DateTime? UpdatedAt { get; set; }

        /// <summary>
        /// 删除状态
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "删除状态")]
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 删除人
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "删除人")]
        public long DeletedBy { get; set; }

        /// <summary>
        /// 删除时间
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "删除时间", IsNullable = true)]
        public DateTime? DeletedAt { get; set; }
    }
}
